{% extends 'base.html' %}
{% load static %}

{% block title %}
    用户中心
{% endblock %}

{% block body %}
    <div class="Bott">
        <div class="wrapper clearfix" style="margin: 0 auto">
            <div class="zuo fl" style="margin-left: 100px">
                <h3>
                    {% csrf_token %}
                    <a href="#"><img src="{% static 'images/tx.png' %}"></a>
                    <p class="clearfix"><span class="fl">[{{ user_obj.username }}]</span>
                        <span class="fr logout">[<a href="#">退出登录</a>]</span></p>
                </h3>
                <div>
                    <ul>
                        <li><a href="{% url 'users:user_index' %}">我的订单</a></li>
                    </ul>
                    <ul>
                        <li><a href="{% url 'users:address' %}">地址管理</a></li>
                    </ul>
                    <ul>
                        <li><a href="/">回到首页</a></li>
                    </ul>

                </div>
            </div>
            <div class="you fl">

                <div class="tx clearfix">
                    <div class="fl clearfix">
                        <a href="#" class="fl"><img src="{% static 'images/tx.png' %}"></a>
                        <p class="fl"><span>六六六</span><a href="#">修改个人信息&gt;</a>
                        </p>
                    </div>
                    <div class="fr">绑定邮箱：{{ user_obj.username }}</div>
                </div>
                <div class="bott">
                    <div class="clearfix">
                        <a href="#" class="fl"><img
                                src="{% static 'images/gxin1.jpg' %}"></a>
                        <p class="fl"><span>待支付的订单：<strong>0</strong></span>
                            <a href="#">查看待支付订单&gt;</a>
                        </p>
                    </div>
                    <div class="clearfix">
                        <a href="#" class="fl"><img
                                src="{% static 'images/gxin2.jpg' %}"></a>
                        <p class="fl"><span>待收货的订单：<strong>0</strong></span>
                            <a href="#">查看待收货订单&gt;</a>
                        </p>
                    </div>
                </div>

            </div>

        </div>
    </div>
{% endblock %}

{% block body_end %}
    <script>
        $('.logout').click(function () {

            $.ajax({
                type: 'post',
                url: '{% url 'users:logout' %}?code=200',
                data: 'csrfmiddlewaretoken=' + $('input[name="csrfmiddlewaretoken"]').val(),
                success: function (data) {
                    window.location = '{% url 'users:login' %}'
                }
            })
        })
    </script>
{% endblock %}